package com.itheima.a05threadnethod2;

public class ThreadDemo {

    /**
     * 线程优先级
     * @param args
     */
    public static void main(String[] args) {

        //创建执行对象
        MyRunable myRunable = new MyRunable();

        //创建线程
        Thread t1 = new Thread(myRunable , "飞机");
        Thread t2 = new Thread(myRunable , "坦克");

        System.out.println(t1.getPriority());
        System.out.println(t2.getPriority());

        //main线程优先级默认也是=5
        System.out.println(Thread.currentThread().getPriority());

        //设置优先级 优先级越高抢到处理机的概率高
        t1.setPriority(Thread.MAX_PRIORITY);
        t2.setPriority(Thread.MIN_PRIORITY);

        t1.start();
        t2.start();




    }
}
